<?php

namespace App\Http\Controllers\Home\Index\Api;

use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use Illuminate\Support\Facades\Redis;
use App\Model\Information;

class IndexApi extends Controller
{   

    /**
     * 获取网站信息
     * @return [Array] 网站信息
     */
    public static function getInformation()
    {
        if (Redis::keys('web_information')) {

            return json_decode(Redis::get('web_information'), true);
        }

        $info = Information::pluck('content', 'name')->toArray();

        Redis::set('web_information', json_encode($info));

        return $info;
    }


}
